<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
      <hello message="哈哈哈"></hello>
      <app-hello></app-hello>
    </div>

    <div id="app2">
        <hello message="哈哈哈"></hello>
      </div>
</body>

<script src="./node_modules/vue/dist/vue.js"></script>
<script>
   //全局组件
   //数据一定要函数的方式声明
   Vue.component("hello", {
    template: `<div>{{message}}</div>`,
    // data() {
    //     return {
    //         message:"hello world!"
    //     }
    // },
    props:["message"]
   })

   //局部组件
    const appHello={
    template: `<div>{{message}}</div>`,
    data(){
        return{
            message:"hello"
        }
    }
   }

   new Vue({
     el:"#app",
    components: {
        "app-hello":appHello
    }
   })

   new Vue({
     el:"#app2"
   })
</script>
</html>